import axios from "axios";
import showMessage from "@/utils/showMessage";

const instance = axios.create();

// 响应拦截器
instance.interceptors.response.use(function (resp) {
  // 响应结果的错误码，code=0时表示正常数据结果，其他则为异常
  if (resp.data.code != 0) {
    showMessage({
      content: resp.data.msg,
      type: "error",
      duration: 354543
    });
    return null;
  }
  return resp.data.data;
});



export default instance;